﻿CREATE TABLE [dbo].[DayTypeRules] (
    [DayTypeName]         NVARCHAR (100) NOT NULL,
    [InstitutionEntityID] INT            NOT NULL,
    [DayTypeRuleName]     NVARCHAR (50)  NOT NULL,
    [DayTypeRule]         NVARCHAR (255) NOT NULL,
    [StartDate]           DATE           NULL,
    [EndDate]             DATE           NULL,
    CONSTRAINT [PK_DayTypeRules_1] PRIMARY KEY CLUSTERED ([DayTypeName] ASC, [InstitutionEntityID] ASC, [DayTypeRuleName] ASC),
    CONSTRAINT [FK_DayTypeRules_DayTypes] FOREIGN KEY ([InstitutionEntityID], [DayTypeName]) REFERENCES [dbo].[DayTypes] ([InstitutionEntityID], [DayTypeName])
);

